<template>
  <el-select v-model="name" placeholder="请选择" filterable clearable>
    <el-option v-for="item in options" :key="item.id" :label="item.customersName" :value="item[valueField]" />
  </el-select>
</template>

<script setup lang="ts">
import { computed, onMounted } from "vue";
const { proxy } = getCurrentInstance();
let props = defineProps(["modelValue", "val"]);
const emit = defineEmits(["update:modelValue"]);
const name = computed({
  get() {
    return props.modelValue;
  },
  set(value: Number) {
    emit("update:modelValue", value);
  },
});
let valueField = computed(() => {
  return props.val ? props.val : "id";
});
let options = ref([]);
onMounted(() => {
  getInfo();
});
let getInfo = async () => {
  let { data } = await proxy.$apis.customerQuery();
  options.value = data;
};
</script>

<style lang="scss" scoped>
</style>
